home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / asm_subr.arc / SFP2DFP < prev    next >
Encoding:
Text File  |  1985-12-28  |  1.9 KB  |  55 lines

  1. ;-------------------------sfp2dfp routine begins--------------------------+
  2. ; ROUTINE FOR CONVERSION FROM SINGLE PRECISION TO DOUBLE PRECISION
  3. ;
  4. ; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
  5. ;         page : 111
  6. ;
  7. ; NAME SFP2DFP
  8. ;
  9. ; FUNCTION: This routine converts from single precision binary floating point
  10. ; to internal double precision floating point.
  11. ;
  12. ; INPUT: Upon entry a number is stored in single precision binary floating
  13. ; point form in SFPBUFF. The single precision binary floating point number
  14. ; has a 24-bit binary mantissa, a sign bit, and an 8-bit exponent biased by
  15. ; 128 (See fig 5-3).
  16. ;
  17. ; OUTPUT: Upon exit a internal double precision binary floating point
  18. ; number is stored in DFPBUFF.  The internal double precision floating point
  19. ; number has a 40-bit binary mantissa, a sign bit,and an 8-bit exponent
  20. ; biased by 128 (See fig 5-8).
  21. ;
  22. ; REGISTERS USED:  No registers are modified.
  23. ;
  24. ; SEGMENTS REFERENCED:  Upon entry the data segment must contain the
  25. ; storage for the variables SFPBUFF and DFPBUFF.
  26. ;
  27. ; ROUTINES CALLED:  None
  28. ;
  29. ; SPECIAL NOTES: Equates are used to shorten address fields.
  30. ;
  31. ; ROUTINE TO CONVERT FROM INTERNAL SINGLE PRECISION FLOATING POINT TO
  32. ; INTERNAL DOUBLE PRECISION FLOATING POINT
  33. ;
  34. sfp2dfp proc    far
  35. ;
  36.     push    ax        ; save registers
  37. ;
  38. ; clear lower part of mantissa
  39.     mov    dfpbuffw0,0    ; clear low word
  40.     mov    dfpbuffw2,0    ; clear next low word
  41. ;
  42. ; move rest of mantissa
  43.     mov    ax,sfpbuffw0    ; get word from single precision
  44.     mov    dfpbuffw4,ax    ; put in double precision
  45. ;
  46.     mov    ax,sfpbuffw2    ; get word from single precision (7 hi bits)
  47.     mov    dfpbuffw6,ax    ; put in double precision
  48. ;
  49.     pop    ax        ; restore registers
  50.     ret            ; return
  51. ;
  52. sfp2dfp    endp
  53. ;-------------------------sfp2dfp routine ends---------------------------+
  54.  
  55.